[Javascript] Javascript echo()?
tedd
tedd at sperling.com
Fri Oct 5 11:49:52 CDT 2007
At 10:16 PM -0600 10/4/07, Scott Reynen wrote:
>On Oct 4, 2007, at 8:23 PM, tedd wrote:
>
>> Hi gang:
>>
>> I'm currently sending data (the value of s) to another script via the
>> html statement:
>>
>> <a href="img.php?s=<?php echo($value);?>">Click here</a>
>>
>> However, I need to add another variable, namely a javascript variable.
>>
>> How can I send both a php and a javascript variable at the same time?
>>
>> Not to mislead anyone with a better idea, but what I need is
>> something in javascript that works like like php's echo().
>>
>> TIA for any replies.
>
>The closest JavaScript equivalent to echo() is document.write;
>however, that only works within <script> tags, which of course can't
>go within attributes of other tags. So it would be better (not least
>because it would be possible) to read the href attribute and append
>the JavaScript variable to it before opening the link, e.g.:
>
><a href="img.php?s=<?php echo($value);?>" onclick="window.open
>( this.getAttribute( 'href' ) + '&t=' + t ); return false;">Click
>here</a>
>
>Peace,
>Scott
Scott:
Your solution worked so cool for all browsers except for Safari. I
thought Safari had it wrong, but the documentation states that unless
the window is opened by javascript, it cannot be assured that it can
be closed by javascript.
Is there a way to tie an open window to javascript's window object?
Or, perhaps another solution to the original problem?
Many thanks for your time and effort.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
More information about the Javascript
mailing list