WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Input/Alert Box help Empty Input/Alert Box help Tue Dec 15, 2009 12:46 pm

Mario

Mario
Registered Member
Registered Member
I need some help in javascript.

I need to know how to make a text area turn into an alert box so what ever you typed will be displayed in the alert box.

I also need to know how to make an input field so when you input a month/year it will show up on the table.


The code that I am using for this is

Code:
<html>
<title>
Webscripting Final
</title>

<script type="text/javascript">
{
 

  var x;


  var class10 = new Array();
 
      class10[0] = 'Economics';
      class10[1] = 'ShakeSpeare';
      class10[2] = 'College Math Prep';
      class10[3] = 'Webscripting';

  var time = new Array();

      time[0] = ' 7:30-9:08';
      time[1] = ' 9:16-11:05';
      time[2] = ' 11:10-12:00';
      time[3] = ' 12:30-1:50';

  var room = new Array();

      room[0] = '  C-16';
      room[1] = '  D-6';
      room[2] = '  P-7';
      room[3] = '  R-135';
 
  var numberofcredits = new Array();
      numberofcredits[0]='.5';
      numberofcredits[1]='1';
      numberofcredits[2]='1';
      numberofcredits[3]='2';

  //alert(room[0]);



  document.write('<table border="2" cellspacing="6" cellpadding="26" align="center">');
  document.write('<tr><td colspan="4" cellspacing="6" cellpadding="26"><center>Cibola High School</center></td></tr>');
 



      for (x = 0; x <= 3; x++) {
  document.write("<tr><td>"+class10[x]+"</td><td>"+room[x]+"</td><td>"+time[x]+"</td><td>"+numberofcredits[x]+"</td></tr>");
      }


  document.write('<tr><td colspan="4"><center>My Graducation May 16, 2010</center></td><tr>');
  document.write('</table>');

}
</script>

<body>
<br />
<center><select>
  <option value="Pick a class">Pick as class</option>
  <option value="Economics">Economics</option>
  <option value="ShakeSpeare">ShakeSpeare</option>
  <option value="College Math Prep">College Math Prep</option>
  <option value="Webscripting">Webscripting</option>
</select></center>


</body>
</html>


Thanks

2Input/Alert Box help Empty Re: Input/Alert Box help Tue Dec 15, 2009 12:56 pm

ankillien

ankillien
Administrator
Administrator
Hi,

You want to have an alert box showing whatever you have typed in the input field. Something like this?

Code:
<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -

function MsgBox (textstring) {
alert (textstring) }

// - End of JavaScript - -->
</SCRIPT>

</HEAD>


<BODY>

<FORM>
<input NAME="text1" TYPE="text">
<INPUT NAME="submit" TYPE=Button VALUE="Show Me" onClick="MsgBox(form.text1.value)">
</FORM>

</BODY>
</HTML>

3Input/Alert Box help Empty Re: Input/Alert Box help Tue Dec 15, 2009 1:07 pm

Mario

Mario
Registered Member
Registered Member
That is it Smile

Thanks

One More

A prompt box that you have to enter the month and day and places it into a table

4Input/Alert Box help Empty Re: Input/Alert Box help Tue Dec 15, 2009 1:16 pm

ankillien

ankillien
Administrator
Administrator
You want both month and day to show in the same table cell?

5Input/Alert Box help Empty Re: Input/Alert Box help Tue Dec 15, 2009 1:17 pm

Mario

Mario
Registered Member
Registered Member
If its possible yes.

6Input/Alert Box help Empty Re: Input/Alert Box help Tue Dec 15, 2009 1:39 pm

ankillien

ankillien
Administrator
Administrator
Here it is...

Code:
<html>
<head>
<title>Receiving a value from the user</title>
</head>
<body>
<script language="Javascript" type="text/javascript">
<!--
getMonth = prompt('Please enter the month.', '');
getDay = prompt('Please enter the day.', '');

var Month = getMonth;
var Day = getDay;

document.write('<table border="1" cellpadding="5"><tr><td>');
document.write(Month + '&nbsp;' + Day);
document.write('</td></tr></table>');
-->
</script>
</body>
</html>

7Input/Alert Box help Empty Re: Input/Alert Box help Wed Dec 16, 2009 3:43 am

Mario

Mario
Registered Member
Registered Member
Thanks ankillien Smile

8Input/Alert Box help Empty Re: Input/Alert Box help Wed Dec 16, 2009 10:56 am

ankillien

ankillien
Administrator
Administrator
No problem mate. Glad i could help Very Happy

9Input/Alert Box help Empty Re: Input/Alert Box help Wed Dec 16, 2009 4:33 pm

Sanket

Sanket
Administrator
Administrator
Solved & hence Locked

http://www.webartzforum.com

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum