Wouter a écrit :
>and no link no more works
The solution that i see now is. whit PHP because thats the only script
langauge i can script. So can i use PHP to strip the url ? So i dont so
anymore javascript:alert('....
in my proposition
javascript
:alert()
was an example of link
I try to use somewhere if(isset($img_url)){ but i think i can't use the
var...
I do not understand what exactly you try to get or to do ...
- If user clicks on one link
the form will not be send, and by the fact no 'img_url' to give to php
- if user clicks on a link, once the file is loaded
the href of the link is clearly seen in browser's address bar
- what is the goal for this input 'img_url' ?
- how do you expect to send the form on each click on a link ?
is it possible what i want. Or is there a better solution whit javascript ?
to answer to your question "copy link in an input" try that :
<html>
<script type="text/javascript">
onload = function() {
var A = document.getElementsByTagName('A');
for(var i=0; i<A.length; i++)
if(A[i].href) {
A[i].onmouseover = function() {
document.myForm.img_url.value = this.href;
}
A[i].onclick = function() {
var o = document.myForm.img_url;
o.value = escape(o.value);
document.myForm.submit();
return false;
}
}
}
</script>
<form name="myForm">
<input name="img_url" size=70>
</form>
<a href="javascript
:alert('hello')">hello</a>
<a href="page.htm">page</a>
<a name="myAnchor"></a>
<a href="page.php?go=somewhere">other where</a>
</html>
To use with the form in php alone
soluce 1:
=========
<form action="linker.php">
<p>go to :<br>
<input type=radio value="page1.php" name="img_url"page 1<br>
<input type=radio value="page2.php" name="img_url"page 2<br>
<input type=radio value="page3.php" name="img_url"page 3<br>
<input type=radio value="page4.php" name="img_url"page 4<br>
<p><input type=submit value=GO>
</form>
soluce 2:
=========
<form action="linker.php">
<p>go to : <select name="img_url">
<option value="page1.php"page 1</option>
<option value="page2.php"page 2</option>
<option value="page3.php"page 3</option>
<option value="page4.php"page 4</option>
</select>
<input type=submit value=GO>
</form>
P.S. sorry for my bad english
If you speak french it could be easier for me :-)
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date