正在处理您的请求...
<script language="javascript" type="text/javascript">
</script>
element block and removes
// previous instances of the identical script.
var found = false;
for (var child = 0; child < head.childNodes.length; child++) {
var control = head.childNodes[child];
if (control.tagName.toUpperCase() == "SCRIPT") {
if (script.src.length > 0) {
if (script.src == control.src) {
found = true;
break;
}
} else if (script.innerHTML.length > 0) {
if (script.innerHTML == control.innerHTML) {
found = true;
break;
}
}
}
}
if (found) {
head.removeChild(control);
}
// Now we append the new script and move on to the next script.
// Note that this is a recursive function. It stops when the
// index grows larger than the number of scripts.
document.getElementsByTagName('head')[0].appendChild(script);
if (typeof script.readyState != "undefined") {
script.onreadystatechange = function() {
if (script.readyState != "complete" && script.readyState != "loaded") {
return;
} else {
Anthem_LoadPageScript(result, index + 1);
}
}
} else {
Anthem_LoadPageScript(result, index + 1);
}
}
} catch (e) {
Anthem_DebugError("Error adding page script to head. " + e.name + ": " + e.message);
}
}
}
function Anthem_EvalClientSideScript(result) {
if (result.script) {
for (var i = 0; i < result.script.length; ++i) {
try {
eval(result.script[i]);
} catch (e) {
alert("Error evaluating client-side script!/n/nScript: " + result.script[i] + "/n/nException: " + e);
}
}
}
}
function Anthem_DebugRequestText(text) {
}
function Anthem_DebugResponseText(text) {
}
function Anthem_DebugError(text) {
}
//Fix for bug #1429412, "Reponse callback returns previous response after file push".
//see http://sourceforge.net/tracker/index.php?func=detail&aid=1429412&group_id=151897&atid=782464
function Anthem_Clear__EVENTTARGET() {
var form = document.getElementById(Anthem_FormID);
Anthem_SetHiddenInputValue(form, "__EVENTTARGET", "");
}
function Anthem_InvokePageMethod(methodName, args, clientCallBack, clientCallBackArg) {
Anthem_Clear__EVENTTARGET(); // fix for bug #1429412
return Anthem_CallBack(null, "Page", null, methodName, args, clientCallBack, clientCallBackArg, true, true);
}
function Anthem_InvokeMasterPageMethod(methodName, args, clientCallBack, clientCallBackArg) {
Anthem_Clear__EVENTTARGET(); // fix for bug #1429412
return Anthem_CallBack(null, "MasterPage", null, methodName, args, clientCallBack, clientCallBackArg, true, true);
}
function Anthem_InvokeControlMethod(id, methodName, args, clientCallBack, clientCallBackArg) {
Anthem_Clear__EVENTTARGET(); // fix for bug #1429412
return Anthem_CallBack(null, "Control", id, methodName, args, clientCallBack, clientCallBackArg, true, true);
}
function Anthem_PreProcessCallBack(
control,
e,
eventTarget,
causesValidation,
validationGroup,
imageUrlDuringCallBack,
textDuringCallBack,
enabledDuringCallBack,
preCallBackFunction,
callBackCancelledFunction,
preProcessOut
) {
preProcessOut.Enabled = !control.disabled;
var preCallBackResult = true;
if (preCallBackFunction) {
preCallBackResult = preCallBackFunction(control);
}
if (typeof(preCallBackResult) == "undefined" || preCallBackResult) {
var valid = true;
if (causesValidation && typeof(Page_ClientValidate) == "function") {
valid = Page_ClientValidate(validationGroup);
}
if (typeof(WebForm_OnSubmit) == "function") {
valid = WebForm_OnSubmit();
}
if (valid) {
var inputType = control.getAttribute("type");
inputType = (inputType == null) ? '' : inputType.toUpperCase();
if (inputType == "IMAGE" && e != null) {
var form = document.getElementById(Anthem_FormID);
if (e.offsetX) {
Anthem_SetHiddenInputValue(form, eventTarget + ".x", e.offsetX);
Anthem_SetHiddenInputValue(form, eventTarget + ".y", e.offsetY);
} else {
Anthem_SetHiddenInputValue(form, eventTarget + ".x", e.clientX - control.offsetLeft + 1);
Anthem_SetHiddenInputValue(form, eventTarget + ".y", e.clientY - control.offsetTop + 1);
}
}
if (imageUrlDuringCallBack || textDuringCallBack) {
if (control.nodeName.toUpperCase() == "INPUT") {
if (inputType == "CHECKBOX" || inputType == "RADIO" || inputType == "TEXT") {
preProcessOut.OriginalText = GetLabelText(control.id);
SetLabelText(control.id, textDuringCallBack);
} else if (inputType == "IMAGE") {
if (imageUrlDuringCallBack) {
preProcessOut.OriginalText = control.src;
control.src = imageUrlDuringCallBack;
} else {
preProcessOut.ParentElement = control.parentElement ? control.parentElement : control.parentNode;
if (preProcessOut.ParentElement) {
preProcessOut.OriginalText = preProcessOut.ParentElement.innerHTML;
preProcessOut.ParentElement.innerHTML = textDuringCallBack;
}
}
} else if (inputType == "SUBMIT") {
preProcessOut.OriginalText = control.value;
control.value = textDuringCallBack;
}
} else if (control.nodeName.toUpperCase() == "SELECT") {
preProcessOut.OriginalText = GetLabelText(control.id);
SetLabelText(control.id, textDuringCallBack);
} else {
preProcessOut.OriginalText = control.innerHTML;
control.innerHTML = textDuringCallBack;
}
}
control.disabled = (typeof enabledDuringCallBack == "undefined") ? false : !enabledDuringCallBack;
return true;
} else {
return false;
}
} else {
if (callBackCancelledFunction) {
callBackCancelledFunction(control);
}
return false;
}
}
function Anthem_PreProcessCallBackOut() {
// Fields
this.ParentElement = null;
this.OriginalText = '';
this.Enabled = true;
}
function Anthem_PostProcessCallBack(
result,
control,
eventTarget,
clientCallBack,
clientCallBackArg,
imageUrlDuringCallBack,
textDuringCallBack,
postCallBackFunction,
preProcessOut
) {
if (postCallBackFunction) {
postCallBackFunction(control);
}
control.disabled = !preProcessOut.Enabled;
var inputType = control.getAttribute("type");
inputType = (inputType == null) ? '' : inputType.toUpperCase();
if (inputType == "IMAGE") {
var form = document.getElementById(Anthem_FormID);
Anthem_RemoveHiddenInput(form, eventTarget + ".x");
Anthem_RemoveHiddenInput(form, eventTarget + ".y");
}
if (imageUrlDuringCallBack || textDuringCallBack) {
if (control.nodeName.toUpperCase() == "INPUT") {
if (inputType == "CHECKBOX" || inputType == "RADIO" || inputType == "TEXT") {
SetLabelText(control.id, preProcessOut.OriginalText);
} else if (inputType == "IMAGE") {
if (imageUrlDuringCallBack) {
control.src = preProcessOut.OriginalText;
} else {
preProcessOut.ParentElement.innerHTML = preProcessOut.OriginalText;
}
} else if (inputType == "SUBMIT") {
control.value = preProcessOut.OriginalText;
}
} else if (control.nodeName.toUpperCase() == "SELECT") {
SetLabelText(control.id, preProcessOut.OriginalText);
} else {
control.innerHTML = preProcessOut.OriginalText;
}
}
if (clientCallBack) {
clientCallBack(result, clientCallBackArg);
}
}
function Anthem_FireCallBackEvent(
control,
e,
eventTarget,
eventArgument,
causesValidation,
validationGroup,
imageUrlDuringCallBack,
textDuringCallBack,
enabledDuringCallBack,
preCallBackFunction,
postCallBackFunction,
callBackCancelledFunction,
includeControlValuesWithCallBack,
updatePageAfterCallBack
) {
var preProcessOut = new Anthem_PreProcessCallBackOut();
var preProcessResult = Anthem_PreProcessCallBack(
control,
e,
eventTarget,
causesValidation,
validationGroup,
imageUrlDuringCallBack,
textDuringCallBack,
enabledDuringCallBack,
preCallBackFunction,
callBackCancelledFunction,
preProcessOut
);
if (preProcessResult) {
Anthem_FireEvent(
eventTarget,
eventArgument,
function(result) {
Anthem_PostProcessCallBack(
result,
control,
eventTarget,
null,
null,
imageUrlDuringCallBack,
textDuringCallBack,
postCallBackFunction,
preProcessOut
);
},
null,
includeControlValuesWithCallBack,
updatePageAfterCallBack
);
}
}
function AnthemListControl_OnClick(
e,
causesValidation,
validationGroup,
textDuringCallBack,
enabledDuringCallBack,
preCallBackFunction,
postCallBackFunction,
callBackCancelledFunction,
includeControlValuesWithCallBack,
updatePageAfterCallBack
) {
var target = e.target || e.srcElement;
if (target.nodeName.toUpperCase() == "LABEL" && target.htmlFor != '')
return;
var eventTarget = target.id.split("_").join("$");
Anthem_FireCallBackEvent(
target,
e,
eventTarget,
'',
causesValidation,
validationGroup,
'',
textDuringCallBack,
enabledDuringCallBack,
preCallBackFunction,
postCallBackFunction,
callBackCancelledFunction,
true,
true
);
}
function GetLabelText(id) {
var labels = document.getElementsByTagName('label');
for (var i = 0; i < labels.length; i++) {
if (labels[i].htmlFor == id) {
return labels[i].innerHTML;
}
}
return null;
}
function SetLabelText(id, text) {
var labels = document.getElementsByTagName('label');
for (var i = 0; i < labels.length; i++) {
if (labels[i].htmlFor == id) {
labels[i].innerHTML = text;
return;
}
}
}
//]]> </script>
Programming Article Collection
<script language="javascript" src="http://tag.csdn.net/urltag.aspx" type="text/javascript"></script> 作者tag:
c/c++一般性问题 CSDN 推荐tag:
函数
文件
cpp
<script type="text/javascript">function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>
#include "stdafx.h"1.extern用在变量声明中常常有这样一个作用,你在*.c文件中声明了一个全局的变量,这个全局的变量如果要被引用,就放在*.h中并用extern来声明。
2.如果函数的声明中带有关键字extern,仅仅是暗示这个函数可能在别的源文件里定义,没有其它作用。即下述两个函数声明没有区别:
extern int f(); 和int f(); |
=================================
如果定义函数的c/cpp文件在对应的头文件中声明了定义的函数,那么在其他c/cpp文件中要使用这些函数,只需要包含这个头文件即可。
如果你不想包含头文件,那么在c/cpp中声明该函数。一般来说,声明定义在本文件的函数不用“extern”,声明定义在其他文件中的函数用“extern”,这样在本文件中调用别的文件定义的函数就不用包含头文件
include “*.h”来声明函数,声明后直接使用即可。
=================================
举个例子:
//extern.cpp内容如下:
// extern.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
extern print(char *p);
int main(int argc, char* argv[])
{
char *p="hello world!";
print(p);
return 0;
}
//print.cpp内容如下
#include "stdafx.h"
#include "stdio.h"
print(char *s)
{
printf("The string is %s/n",s);
}
结果程序可以正常运行,输出结果。如果把“extern”去掉,程序依然可以正常运行。
由此可见,“extern”在函数声明中可有可无,只是用来标志该函数在本文件中定义,还是在别的文件中定义。只要你函数在使用之前声明了,那么就可以不用包含头文件了。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=272912
<script type="text/javascript">function hide(){hideComment();}</script>
<script type="text/javascript">document.write("
");</script>
<script language="javascript" type="text/javascript"> ad_width=468; ad_height=60; adcss=2; unionuser=19; ad_type='j'; count=5; </script> <script type="text/javascript" src="http://tagegg.csdn.net/showads.js" language="javascript"></script> <script src="http://tagegg.csdn.net/b.aspx?action=displayad&unionuser=19&unionurl=http%3A%2F%2Fblog.csdn.net%2Fryman%2Farchive%2F2005%2F01%2F29%2F272912.aspx&adcss=2&ad_type=j&width=468&height=60&ad_color=&ad_color_border=&count=5" language="JavaScript1.1" type="text/javascript"></script> <script type="text/javascript" src="http://blog.csdn.net/js/showgm.js" language="javascript"></script>
<script src="http://www.csdn.net/common/counter.js" type="text/javascript"></script>
width="0" scrolling="no" height="0" frameborder="no" src="http://www.csdn.net/ggmm/dd333.htm" border="0" name="myframe" id="myframe">
<script language="javascript" type="text/javascript">
</script>