Jump to content

New to javascript. simple variaboles.


paulman888888

Recommended Posts

hi; i have been trying to learn javascript and think i understand i tiny bit.

 

I know my code below will not work but i have been trying, but i am losing my will to live.

 

<script type="text/javascript">
var uploaded=0;
var uploads=10;
function check_uploads(){
if(uploaded=uploads){
upload_completed();
}}

function upload_completed(){
copy_variables();

submit.form.MYFORMID;
}
function copy_variable(){
form.copy_to_me.fieldid.value=form.formid.fieldid.value;
}
</script>

 

Can someone make this in to a script that will work please syntax-wize anyway.

I think i would be able to make my whole script work if i had an example piece of code.

 

Also if i have an iframe and want to add to a variable thats in not in the iframe, do i need to do anything more then if it wasn't.

 

I very sorry for my bad word but i am trying to learn.

Please don't to nasty.

Thankyou all

Paul

Link to comment
Share on other sites

if(uploaded=uploads){

 

 

Perhaps that should be

 

 

if(uploaded==uploads){

 

 

Errrr

 

submit.form.MYFORMID;  <--  Where's that coming from?

 

form.copy_to_me.fieldid.value=form.formid.fieldid.value; <--  Where's that coming from?

 

 

Link to comment
Share on other sites

Sorry about my last post. It was very bad.

 

in the head i have

<script type="text/javascript">
var uploaded=0;
var uploads=1;

function start_uploads(){document.forms["form_image_"1].submit()}

function upload_completed(){
document.last.submit();
}

function check_uploads(){
if(uploaded==uploads){
upload_completed();
}}

function upload_complete(id){
var x=document.getElementById("image_upload_result"+id);
x.innerHTML="Upload Complete";
uploaded+=1;
check_uploads();
}

</script>

 

and in the <body> i have

<div id="image_upload_result1">
<form method="post" action="mysite.com/?page=Gallery&action=Uploader" target="the_uploader_1" name="form_image_1">
<input type="hidden" name="MAX_FILE_SIZE" value="4608" />
<input type="hidden" name="id" value="1" />
<p class="meta">Image <b>1</b>
</p>Image Name; <input name="image_name" value="" />
<br />Image Desc; <input name="image_desc" value="" /><br />

<input type="file" name="image"/>
<iframe id="uploader_1" name="the_uploader_1" style="width:0px; height:0px; border: 0px" src=""></iframe>
<br /><br /></form></div>
<a href="javascript:void(0);"  onClick="start_uploads();">Start Uploading</a>

 

As you may see i have been trying to upload a image into a hidden IFRAME.

 

Please can someone point out where i have gone and some good sites to learn form. I have already gone though w2schools about 5 times.

 

Thankyou all in advance

Paul

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.