
25-01-2008, 16:56
|
|
|
|
חבר מתאריך: 15.08.06
הודעות: 1,561
|
|
אתה יכול להשתמש ב2 פקודות, אבל עדיף יותר להשתמש בפונקציה.
הדוגמא שלי:
קובץ a.html:
קוד:
<html>
<head>
<script type="text/javascript">
function check(kuku)
{
newWindow = window.open('b.html',null, '');
setTimeout("newWindow.document.getElementById('answer').value = '" + kuku + "'",2);
}
</script>
</head>
<body>
</script>
</head>
<body>
<p>What's your favorite browser?</p>
<form>
<input type="radio" name="kuku" onclick="check(this.value)" value="Internet Explorer">Internet Explorer<br />
<input type="radio" name="kuku" onclick="check(this.value)" value="Firefox">Firefox<br />
<br />
Your favorite browser is: <input type="text" id="answer" size="20">
</form
</body>
</html>
קובץ b.html:
קוד:
<html>
<head>
</head>
<body>
<form>
<input type="text" id="answer" />
</form>
</body>
</html>
הסיבה שיש שם setTimeout היא כדי לתת זמן לחלון להיפתח, אחרת הוא ייתן שגיאה. הזמן שאני נותן פה זה 2 מילישניות, כך שהמשתמש לא ירגיש בכלום, אבל זה מספיק זמן בשביל שהחלון החדש יפתח
|