How to Get the whole query string text from address bar
Posted On at by milanIn PHP you can get the query string text with is separated by URL via '?' character. For this you can use 'query_string' with server variable.
So you can use it like
echo $_SERVER['QUERY_STRING'];
?>
So, for following URL in address bar:-
www.mobifonz.com?var1=3&var3=this
Output will be:-
var1=3&var3=this
And for following URL in address bar:-
www.mobifonz.com?this_Is_Some_Text
Output will be:-
this_Is_Some_Text
Means it will return anything after the '?' sign.
HTML tag to display the html code on webpage
Posted On at by milanHighlight Text Inside Div
Posted On at by milanfunction selectText(divID) //divID contains actual id of 'div' element
{
var textC=document.getElementById(divID);
if (document.selection)
{
//Portion for IE
var div = document.body.createTextRange();
div.moveToElementText(textC);
div.select();
}
else
{
//Portion for FF
var div = document.createRange();
div.setStartBefore(textC);
div.setEndAfter(textC);
window.getSelection().addRange(div);
alert(div.value);
}
}
javascript to partial text in a div element
Posted On at by milanSome times we need mechanisms to select(highlight) partial text in a div or td element, lets say on click of a button. So that visitor just right click on selected text and copy the text to paste it anywhere else.
The code I am going to publish selects the div elements on the base of starting character and length of div text.
Lets say if you want to select first 500 characters in div you will provide the "start" argument as 0 and length as 500.
Similarly, you can choose to select(highlight) the text form 100th character to 600th in the div. In this case you will provide the "start" as 100 and "length" as 600. First argument will be id of div element in which text is to be select.
Lets go to the actual code now. here goes the select text function.
function selectText(ID, start, length)
{
if (document.selection)
{
//Code for IE and few other
document.selection.empty();
var textC = document.getElementById(ID);
var div = document.body.createTextRange();
div.moveToElementText(textC);
div.setEndPoint("EndToEnd", div);
div.moveStart('character', start);
if(length + start>textC.innerHTML.length)
length=textC.innerHTML.length-start;
div.moveEnd('character', -(textC.innerHTML.length - start - length));
div.select();
}
else
{
//code for FF and few other
window.getSelection().removeAllRanges();
var textC = document.getElementById(ID);
while ( textC.hasChildNodes() ) textC = textC.childNodes[0];
var div = document.createRange();
div.setStart(textC, start);
if (start+length > textC.length) length = textC.length - start;
div.setEnd(textC, start+length);
window.getSelection().addRange(div);
}
return false;
}
Now this is how we will implement this in HTML for lets say selecting first 500 characters in this case.
Some text here to be selected...
get visitors IP
Posted On at by milaneasy code from Coldfusion send email with attachment
Posted On at by milan
from="sendersaddress@anysite.com"
subject="my first email with attachment"
type="text"
mimeattach="subfolder/folder/mypdf.pdf"> (path of file, which is to be attached)
hi,
This is me sending you attached file.
Bye,
sender
PHP Get the whole query string text from address bar
Posted On at by milanIn PHP you can get the query string text with is separated by URL via '?' character. For this you can use 'query_string' with server variable.
So you can use it like
echo $_SERVER['QUERY_STRING'];
?>
So, for following URL in address bar:-
www.mobifonz.com?var1=3&var3=this
Output will be:-
var1=3&var3=this
And for following URL in address bar:-
www.mobifonz.com?this_Is_Some_Text
Output will be:-
this_Is_Some_Text
Means it will return anything after the '?' sign.
display the html code on webpage
Posted On at by milanBut XMP tag method is more convinient. The html code you want to show on a webpage just surround it with XMP code and thats it.
Enjoy! Your comments are always welcome.
Coldfusion get visitors IP
Posted On at by milanOR just set a variable with IP like
Enjoy!!
Coldfusion send text email
Posted On at by milan
to="email@site.com"
cc="address2@site.com"
bcc="anyaddress@site.com"
from="sender@site.com"
subject="Check this out" type="text">
Dear Friend,
I have searched out a good website which says it all about coding.
I would like you to check it out.
Site is: http://codingtricks.blogspot.com
Regard,
Mail Sender :-)
Coldfusion send email with attachment files
Posted On at by milanfrom="sendersaddress@anysite.com"
subject="my first email with attachment"
type="text"
mimeattach="subfolder/folder/mypdf.pdf"> (path of file, which is to be attached)
hi,
This is me sending you attached file.
Bye,
sender