Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set a new PHP variable from a HREF using JavaScript

Status
Not open for further replies.

javadeano

MIS
Sep 4, 2003
1
GB
I am new to Javascript.

I have an href that opens a new page in an iframe, but I also need to change the main page once this href is clicked.

I belive I need Javascript to do this?

Please could someone point me to a tutorial or example of how I would do this, I have searched but I am really unsure of what I am looking for.

My main page is written in PHP therefore when the Javascript variable is set to a specific value I need to display additional information.

Can this be done or am I "barking up the wrong tree".

Any help appreciated.
 
Load the page below, it demonstrates javascript's
control of the browser location object.

window.open opens new window
window.location just redirects current window

.href
.replace

May be of interest as well.
<html>
<head>
<title>Window.Open</title>
<script language=&quot;JavaScript&quot;>
var url_loc = &quot;var url_xtn = '#Browser';
function nwurl() {
if(confirm(&quot;Do You Want to Open in a New Window?&quot;)) {
window.open(url_loc+url_xtn);}
else {
window.location = (url_loc+url_xtn);
}
}
</script>
</head>
<body>
<input type=&quot;button&quot; value=&quot;GO URL&quot; onClick=&quot;nwurl()&quot;><br/>
Click this button for a summary of window objects that
may be helpful to you....
</body>
</html>

2b||!2b
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top