⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 submitform.js

📁 USB设计的一些源码!适合与USB开发的同学!还是蛮不错的!我用过一些!
💻 JS
字号:
//Functions concerning the inbox--------------------------------------------------------------------
//inserted on 08.02.99 by Peter Schwarze

//for two active services, quits the first, jumps to the second
function quit_n_jump(old_url,new_url){
hiddenimg = new Image()
hiddenimg.src = old_url+'?~OkCode=/NEX'
call_set_url('top.location',new_url,500)
}

//This function is collecting all the inputs from a given form
//and puts them into a string.
//Afterwards this string will be added to a given url as a query string.
//This url is then loaded in the background, and the current url is set to another given url.
//This has the effect of submitting a form, but jumping to a different url as given in the action
//of that form.
function store_img(formname,radioname,url,inbox_url,no_input){

q_string = new String();

if (radioname != 'BLANK')
	{
	radio_0 = eval('document.'+formname+'.'+radioname+'[0]');
	radio_1 = eval('document.'+formname+'.'+radioname+'[1]');
	formular = eval('document.'+formname);
	
	if (radio_0.checked || radio_1.checked)
		{
		if(radio_0.checked)
			{
			q_string = radioname + "=0";
			}
		else
			{
			q_string = radioname + "=1";	
			}
		}
	else
		{
		alert(no_input);
		return;
		}

	}//if (radioname != 'BLANK') 

formular = eval('document.'+formname);
for(i=0;i<formular.length;i++)
	{
	if((formular.elements[i].name != radioname && formular.elements[i].value != '')&&(formular.elements[i].type == 'hidden'))
		{
		if(q_string !="")
			{
			q_string = q_string +'&'+ formular.elements[i].name + "=" + formular.elements[i].value;			
			}
		else
			{
			q_string = formular.elements[i].name + "=" + formular.elements[i].value;
			}
		}
	}
hiddenConfirm = new Image();
hiddenConfirm.src = url+"?"+q_string;
call_set_url('top.location',inbox_url+'&~dec_state=1&~confirm_url='+url,500)

}//function


//This one is called onLoad of template 200, to end the 2nd session
function logoff(hiddenurl,win1,win2,url,line){
if (win1 == win2)
	{
	if (line != 'BLANK')
		{
		document.location.href = url+'?~line='+line;
		}
	else
		{
		document.location.href = url;
		}
	}
else
	{
		hiddenImg= new Image();
   	hiddenImg.src=hiddenurl;
	if(top.FRAME_2.theForm && line != 'BLANKE')
		{	// we are back in the inbox
		call_set_url('top.FRAME_2.location',top.FRAME_2.theForm.refresh_url.value+'&~OKCode=DISP',500);
		}
	}
}

// these functions are made to refresh an additional frame
// for example at an onClick event from a link.
// 'what' means the location object which belongs to a certain frame,
// 'url' means the new url for that frame
// 'del' stans for the delay to load the url
// only the function 'call_set_url' is to be called
// example:
// OnClick="call_set_url('top.FRAME_3.location','`wgateURL(~frameName="FRAME_3")`',500)"
function set_url(what,url){	
page = eval(what);
page.href = url;
}
function call_set_url(what,url,del){
setTimeout('set_url(\''+what+'\',\''+url+'\')',del);
}

// submits forms from the HTML buttons
// onClick="SetOkCode('OK_code','target_name','form_name',FieldName,FieldValue)"
// This function is a copy of the function SetOkCode from below, it works in the 
// same way, but it has 2 parameters more: FieldName and FieldValue.
// With this additional parameters a hidden input field can be set
// dynamically. The hidden input field has to be in the form as 3rd element
// with void name and value: 
//1.    <input type="hidden" name="~OKCode" value="">
//2.    <input type="hidden" name="~Target" value="">
//3.    <input type="hidden" name="" value="">

function SetOkCode2(FCode,TCode,FormName,FieldName,FieldValue) {
	var whichform;

	if (FormName != "THREEFORMS" && FormName != "") {
		whichForm = eval("document." + FormName);

		whichForm.elements[0].value = FCode;
		whichForm.elements[2].name = FieldName;
		whichForm.elements[2].value = FieldValue;

		//if it is multi frame APP, the target gets set.
		if (TCode != "BLANK" ) {
			whichForm.elements[1].value = TCode;
		   whichForm.target = TCode ;
			}
//*****
fillFormWP(TCode, whichForm);
		whichForm.submit();
		} // end if just submitting one form

	// TCode must be BLANK!
	// forms must submit to their own frame
	// targets should be in forms on the individual pages
	else if (FormName == "THREEFORMS") {
		for (var x=2; x<5; x++) {
			whichForm = eval("top.FRAME_" + x + ".document.theForm");
			whichForm.submit();
			} // end for
		whichForm = eval("top.FRAME_1.document.theForm");
		whichForm.elements[0].value = FCode;
		whichForm.elements[2].name = FieldName;
		whichForm.elements[2].value = FieldValue;
		whichForm.submit();

		} // end if submitting multiple forms

	else {
		alert("no frame name was specified")
		} // end else. if framename was blank

	};



//End functions concerning the inbox----------------------------------------------------------------

// called by onMouseover="roll(this)"
// works in IE4 only
// changes color of button text
function roll(hrefRoll) {
	if (document.all) hrefRoll.style.color = "#C2AA8E";
	} // end roll

// called by onMouseout="unRoll(this)"
// works in IE4 only
// changes color of button text
function unRoll(hrefRoll) {
	if (document.all) hrefRoll.style.color = "white";
	} // end unRoll


// submits forms from the HTML buttons
// onClick="SetOkCode('OK_code','target_name','form_name')"
// FCode is the OK code
// TCode is the name of the frame the results are supposed to go into
// FormName is the name of the form that is being submitted.
//
// if the form is being submitted from a non-frame app, then the
// TCode should be equal to BLANK.
// TCode must be the name of the frame (NOT _self, _top, etc...)
//
// FormName must be the name of the <form name="formName">
// upper/lower case is important!
function SetOkCode(FCode,TCode,FormName) {
	var whichform;

	if (FormName != "THREEFORMS" && FormName != "") {
		whichForm = eval("document." + FormName);

		whichForm.elements[0].value = FCode;

		//if it is multi frame APP, the target gets set.
		if (TCode != "BLANK" ) {
			whichForm.elements[1].value = TCode;
		   whichForm.target = TCode ;
			}
//*****
fillFormWP(TCode, whichForm);
		whichForm.submit();
		} // end if just submitting one form

	// TCode must be BLANK!
	// forms must submit to their own frame
	// targets should be in forms on the individual pages
	else if (FormName == "THREEFORMS") {
		for (var x=2; x<5; x++) {
			whichForm = eval("top.FRAME_" + x + ".document.theForm");
			whichForm.submit();
			} // end for
		whichForm = eval("top.FRAME_1.document.theForm");
		whichForm.elements[0].value = FCode;
		whichForm.submit();

		} // end if submitting multiple forms

	else {
		alert("no frame name was specified")
		} // end else. if framename was blank

	};


// submits forms from the HTML buttons
// onClick="submitF4Form('OK_code','firstform_name', 'secondform_name')"
// FCode is the OK code
// formName is the name of the form that is being submitted.
// form2Name is the name of the other form.
// formName must be the name of the form name="first/second"
// upper/lower case is important!

function submitF4Form(FCode,formName,form2Name,form3Name) {
	var whichForm;
	whichForm = eval("document." + formName);
	var other2Form;
	other2Form = eval("document." + form2Name);
	whichForm.elements[0].value = FCode;
	whichForm.elements[1].value = other2Form.elements[0].value
      if (form3Name != "") {
	  var other3Form;
	  other3Form = eval("document." + form3Name);
	  whichForm.elements[2].value = other3Form.elements[0].value
        }
	whichForm.submit();
	};




// code for deleting items out of a file
function deleteLine(FCode,TCode,FormName,Number) {
	var whichForm = eval("document." + FormName);
	whichForm.elements[0].value = FCode;
	//if it is multi frame APP, the target gets set.
	if (TCode != "BLANK" ) {
		whichForm.elements[1].value = TCode;
	   whichForm.target = TCode ;
		}
	whichForm.elements[2].value = Number
	whichForm.submit();
	};


// To be used when there is a third value that needs to get
// submitted with the form.
// IE the personalize submit button on the LOGIN page
// onClick="anotherField('whatever','_top','theForm','PID')"
// <input type="hidden" name="~function" value="hidden">
function anotherField(FCode,TCode,FormName,extraFieldValue) {

	var whichForm = eval("document." + FormName);
	whichForm.elements[0].value = FCode;

	//if it is multi frame APP, the target gets set.
	if (TCode != "BLANK" ) {
		whichForm.elements[1].value = TCode;
	   whichForm.target = TCode ;
		}
	whichForm.elements[2].value = extraFieldValue;

	whichForm.submit();
	};


// OLD VERSION
// onClick="<!-- url call -->"
// submits form with correct url. from href statements.
function submitForm(url){
	document.theForm.action = url;
	document.theForm.submit();
	return false
	}
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -